package cn.iocoder.yudao.module.liveprice.apihttp;


import cn.iocoder.yudao.framework.common.core.ArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

@Getter
@AllArgsConstructor
public enum NowApiTypeEnum implements ArrayValuable<Integer> {
//    GOLD_OUNCE(1201, "现货黄金(XAU)"),
//    SILVER_OUNCE(1203, "现货白银(XAG)"),
//    PLATINUM_OUNCE(1204,"现货铂金(XAP)"),
//    PALLADIUM_OUNCE(1202, "现货钯金(XPD)"),
//    GOLD_OUNCE_HK(1205, "香港黄金(GT)"),
//    GOLD_OUNCE_TW(1206, "台两黄金(TWGD)"),
    GOLD_GRAM(1301, "黄金(CSAU)", "gold", 1),
    SILVER_GRAM(1302, "白银(CSAG)", "silver", 2),
    PLATINUM_GRAM(1303, "铂金(CSPT)", "platinum", 3),
    PALLADIUM_GRAM(1304, "钯金(CSPD)", "palladium", 4),
    ;

    public static final Integer[] ARRAYS = Arrays.stream(values()).map(NowApiTypeEnum::getType).toArray(Integer[]::new);

    /**
     * 类型
     */
    private final Integer type;
    /**
     * 类型名
     */
    private final String name;
    private final String tag;
    private final Integer materialType;

    @Override
    public Integer[] array() {
        return ARRAYS;
    }

    public static NowApiTypeEnum getType(Integer type) {
        for (NowApiTypeEnum value : NowApiTypeEnum.values()) {
            if (Objects.equals(value.type, type)) {
                return value;
            }
        }
        return null;
    }

}
